import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';

class Three extends StatefulWidget {
  @override
  _ThreeState createState() => _ThreeState();
}

class _ThreeState extends State<Three> with SingleTickerProviderStateMixin {

  ScrollController _scrollViewController;
  TabController _tabController;

  var num = 1;

  @override
  void initState() {
    super.initState();
    _scrollViewController = ScrollController();
    _tabController =
        TabController(vsync: this, length: 3); // 和下面的 TabBar.tabs 数量对应
  }

  @override
  void dispose() {
    _scrollViewController.dispose();
    _tabController.dispose();
    super.dispose();
  }

  TextStyle FontStyle = TextStyle(
    fontSize: 30,
    color: Colors.black,
  );

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Center(
          child: Icon(
            Icons.message,
            color: Colors.purpleAccent,
            size: 30,
          ),
        ),
        elevation: 0,
        automaticallyImplyLeading: false,
        backgroundColor: Colors.white,
        actions: <Widget>[
          Padding(
            padding: EdgeInsets.all(2),
            child: Icon(Icons.camera,color: Colors.grey,),
          )
        ],
        bottom: TabBar(
          isScrollable: true,
          controller: _tabController,
          indicatorColor: Colors.purpleAccent,
          labelColor: Colors.black,
          labelStyle: TextStyle(fontSize: 18),
          indicatorWeight: 2,
          tabs: <Widget>[
            Tab(
              text: "收件箱",
            ),
            Tab(
              text: "谁看了我",
            ),
            Tab(
              text: "Favorites",
            )
          ],
          onTap: (num) {
            setState(() {
              num = 1;
              if(num == 1) {

              }
            });
          },
        ),
      ),
      body: TabBarView(controller: _tabController, children: <Widget>[
        Padding(
          padding: EdgeInsets.all(20),
          child: Column(
            children: <Widget>[
              Text('信息'),
              Center(
                child: Image.asset("images/love.png"),
              ),
              Text("Nothing Happend"),
            ],
          ),

        ),
        Padding(
          padding: EdgeInsets.all(20),
          child: Text('谁看了我'),
        ),
        Padding(
          padding: EdgeInsets.all(20),
          child: Text('Favorites'),
        ),
      ]),
    );
  }
}
